<%@ page language="java" import="java.util.*,com.tjsinfo.tjsoa.system.vo.User,com.tjsinfo.tjsoa.address.inside.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="java.net.URLEncoder"/>
<%@page import="com.tjsinfo.tjsoa.common.DealString;"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	List<TAddresslistInside> addresslists = (List) request.getAttribute("inside");
    DealString ds=new DealString();
    String chinese_name=request.getParameter("chinese_name");
    String newStrchinesename=(String)request.getAttribute("chinese_name");
	String department=request.getParameter("department");
	String newStrdepartment=(String)request.getAttribute("department");
	String cid=request.getParameter("cid");
	if(cid.equals("1")){
	   chinese_name=URLEncoder.encode(newStrchinesename,"UTF-8");
	   department=URLEncoder.encode(newStrdepartment,"UTF-8");
	}else{
	   chinese_name=URLEncoder.encode(chinese_name,"UTF-8");
	   department=URLEncoder.encode(department,"UTF-8");
	};
	User tsui=(User)request.getSession().getAttribute("user");
	String organizeId=request.getParameter("organizeId");
	String url=basePath+"tjsinfo/tjsoa/address/insideListFind.do?chinese_name="+chinese_name+"&department="+department+"&organizeId="+organizeId+"&cid=1";
%>
<%
	int intPage;
	int intPageSize =12;//一页显示的行数
	int intPageCount;//总页数
	int intRowCount;//总行数
	String strPage;
	intRowCount = addresslists.size();
	intPageCount = (intRowCount + intPageSize - 1) / intPageSize;
	strPage = request.getParameter("page");
	if (strPage == null) {//表明在QueryString中没有page这一个参数，此时显示第一页数据 
		intPage = 1;
	} else {//将字符串转换成整型 
		intPage = Integer.parseInt(strPage);
		if (intPage < 1)intPage = 1;
	}
	if (intPage > intPageCount)intPage = intPageCount;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>天津市粮油集团有限公司 OA办公自动化协作平台</title>
		<link href="<%=basePath%>address/style/css.css" rel="stylesheet" type="text/css" />
		<script type='text/javascript' src='<%=basePath%>address/js/util.js'></script>
		<script type='text/javascript' src='<%=basePath%>address/js/engine.js'></script>
		<script type='text/javascript' src='<%=basePath%>address/js/userService.js'></script>
		<script type='text/javascript' src='<%=basePath%>address/js/time.js'></script>
		<script type='text/javascript' src='<%=basePath%>address/js/mousechangecolor.js'></script>
		<style>
body {
	font-size: 11px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}

a {
	color: #000;
	text-decoration: none;
}

.img {
	border: 0px;
}

.black_overlay {
	display: none;
	position: absolute;
	top: 0%;
	left: 0%;
	width: 100%;
	height: 100%;
	background-color: gray;
	z-index: 1001;
	-moz-opacity: 0.8;
	opacity: .80;
	filter: alpha(opacity =     80);
}

.white_content {
	display: none;
	position: absolute;
	top: 35%;
	left: 35%;
	width: 232px;
	height: 145px;
	border: 16px solid #FFF;
	border-bottom: none;
	background-color: white;
	z-index: 1002;
	overflow: auto;
}
</style>
	<script type="text/javascript">
	window.onload = function(){parent.iFrameHeight();}
		function deleteFunction(id,chinese_name){	
			if(confirm('你真得要删除数据吗?\r删除后不能恢复.\r请慎重操作.')){
				window.location.href='<%=basePath %>tjsinfo/tjsoa/address/insideDelete.do?id='+id+'&chinese_name='+chinese_name;
			}
		}
	</script>
	<script type="text/javascript">
		<!--
		function submitpages(value){
			if(value==0){
				alert("请重新选择页码!");
				return ;
			}
			//alert(value);
			var URL= '<%=basePath %>tjsinfo/tjsoa/address/insideListFind.do?chinese_name=<%=chinese_name %>&department=<%=department %>&organizeId=<%=organizeId %>&cid=0&page=';
			window.location.href=URL+value;	
		}
		//-->
		</script>
	</head>

	<body>
		<div id="tab_01" style="width:100%;height:470px;table-layout:fixed;">
    		<div id="index_title">
			    <ul>
			        <li><a href="<%=basePath %>tjsinfo/tjsoa/address/commonList.do" style="cursor:hand"><span>公共通讯录</span></a></li>
                    <li class="over"><a href="<%=basePath %>tjsinfo/tjsoa/address/insideList.do" style="cursor:hand"><span>内部通讯录</span></a></li>
 <!--               <li><a href="<%=basePath %>tjsinfo/tjsoa/address/personalList.do" style="cursor:hand"><span>个人通讯录</span></a></li>   --> 
			    </ul>
		    </div>
			<table cellspacing="0" class="tab_user" style="width:100%;table-layout:fixed;bgcolor:#a8c7ce;" onmouseover="changeto()"  onmouseout="changeback()">
				<tbody>
					<tr style="width:100%;">
						<th width="80">
							姓名
						</th>
						<th width="160">
						     部门
						</th>
						<th width="200">
							职务
						</th>
						<th width="120">
						    办公电话
						</th>
						<th width="120">
						    内线电话
						</th>
						<!-- <th width="120">
						    手机号
						</th> -->
					</tr>
					<%
					if (intPageCount > 0) {
						//将记录指针定位到待显示页的第一条记录上 
						int i=((intPage - 1) * intPageSize );
						for(int j=0;j<intPageSize && i<intRowCount;j++,i++){
							TAddresslistInside addresslist = addresslists.get(i);
					%>
					<tr id="tr<%=i%>">
						<td <%if(j%2==0)out.println("bgcolor='#F4F4F4'"); %>>&nbsp;
					        <a href="<%=basePath %>tjsinfo/tjsoa/address/toInsideUpdate.do?id=<%=addresslist.getId() %>&page=<%=intPage %>" style="color: blue">
					        <%
					          String organid=addresslist.getChineseName();
					          organid=ds.substring(organid,4);
					          out.println(organid); 
					        %>
					        </a>
						</td>
						<td <%if(j%2==0)out.println("bgcolor='#F4F4F4'"); %>>&nbsp;
							<%
							  if(addresslist.getDepartment()!= null){
							     String organDepartment=addresslist.getDepartment();
							     organDepartment=ds.substring(organDepartment,8);
								 out.println(organDepartment);
							  }
							%>
						</td>
						<td <%if(j%2==0)out.println("bgcolor='#F4F4F4'"); %>>&nbsp;
							<%
							  if(addresslist.getOfficeship()!=null){
							     String organOfficeship=addresslist.getOfficeship();
							     organOfficeship=ds.substring(organOfficeship,20);
							     out.println(organOfficeship);
							  }
							%>
						</td>
						<td <%if(j%2==0)out.println("bgcolor='#F4F4F4'"); %>>&nbsp;
							<%
							  if(addresslist.getOfficePhone() != null){
							     String organOfficePhone=addresslist.getOfficePhone();
							     organOfficePhone=ds.substring(organOfficePhone,17);
							     out.println(organOfficePhone);
							  }
							%>
						</td>
						<td <%if(j%2==0)out.println("bgcolor='#F4F4F4'"); %>>&nbsp;
						    <%
						      if(addresslist.getInlineNo()!=null){
						         String organInlineNo=addresslist.getInlineNo();
						         organInlineNo=ds.substring(organInlineNo,17);
						         out.println(organInlineNo);
						      }
						    %>
						</td>
					<%-- 	<td <%if(j%2==0)out.println("bgcolor='#F4F4F4'"); %>>&nbsp;
							<%
							  if(addresslist.getMobile()!= null){
							     String organMoblie=addresslist.getMobile();
							     organMoblie=ds.substring(organMoblie,17);
							     out.println(organMoblie);
							  }
							%>
						</td> --%>
					</tr>
					<%}}%>
				</tbody>
			</table>
			<div class="page">
				<%if(intPage>=2) {%><a href="<%=basePath %>tjsinfo/tjsoa/address/insideListFind.do?chinese_name=<%=chinese_name %>&department=<%=department %>&organizeId=<%=organizeId %>&cid=0&page=<%=intPage - 1%>">上一页</a> <%} %>
				<%if(intPage<intPageCount) {%><a href="<%=basePath %>tjsinfo/tjsoa/address/insideListFind.do?chinese_name=<%=chinese_name %>&department=<%=department %>&organizeId=<%=organizeId %>&cid=0&page=<%=intPage + 1%>">下一页</a><%} %>&nbsp;&nbsp;&nbsp; 
				页次:<STRONG><%=intPage %></STRONG>/<%=intPageCount %>页 共<%=addresslists.size() %>条记录 <%=intPageSize %>条/页
				<select name="select8" onChange="submitpages(this.value)">
	        		      <option value="0">--跳转--</option>
	        		      <%
	        		      	for(int pi=1;pi<=intPageCount;pi++){
	        		      %>
	        		      	<option value="<%=pi%>"><%=pi%></option>
	        		      <%} %>
	            </select>
			</div>
			<div class="tab_btn">
				<a href="<%=basePath %>tjsinfo/tjsoa/address/toInsideListFind.do"><img src="<%=basePath%>address/images/find_btn.gif" width="40" height="15" /> </a>
			</div>
			<div class="clear"></div>
		</div>
	</body>
</html>
